import React, { PureComponent } from 'react';
import { Form, Select, Card, Input, Button, DatePicker, Table, Icon, Divider, message,Tabs  } from 'antd';
import moment from 'moment';
import { connect } from 'dva';
import EmergPerson from "./components/Emergency/EmgergencyPerson/EmergPerson";
import EmergEquip from './components/Emergency/EmgergencyEquip/EmergEquip';
@connect(({ assessment,global}) => ({
  currentUrl: global.currentUrl,
    companyList: assessment.companyList,
}))
class Emergency extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
    };
    this.dispatch = this.props.dispatch;
  }
  fetchGetCompany = () => {

    this.dispatch({
      type: 'assessment/fetchGetCompany',
      payload: {
        type: '养护维修',
      },
      callback: response => {
        message.error.error('养护单位获取失败');
        console.log(response);
      },
    });
  }
  getAuth = () => {
    const { dispatch, currentUrl,match } = this.props;
    dispatch({
      type: 'global/fetchUrl', payload: match.url, callback: response => {
       
      }
    });
    dispatch({
        type: 'global/fetchAuthorityElements',
        payload: { url:  match.url },
    });
 };
  componentDidMount = () => {
    this.getAuth();
    !this.props.companyList && this.fetchGetCompany();
}
  render() {
    return (
      <>
      <Tabs defaultActiveKey="1">
          <Tabs.TabPane tab="人员表" key="1">
            <EmergPerson />
          </Tabs.TabPane>
          <Tabs.TabPane tab="装备表" key="2">
            <EmergEquip />
          </Tabs.TabPane>
        </Tabs>
      </>

    );

  }


}

export default Emergency;